package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class OSWDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos =new FileOutputStream("student.obj");
        //创建转换流时通常会指定第2个参数来明确字符集,以此来保证跨平台性
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        osw.write("练习时长林两年半,");
        osw.write("爱好打篮球!");
        System.out.println("输出完成!");
        osw.close();
    }
}
